package com.you07.learn.utils;

/**
 * @ClassName: ResultMessage
 * @Author: chenguo
 * @Data: 2019年06月06日 15时53分
 * @Description:
 * @Company: 成都灵奇空间软件
 * @Version: 1.0
 */
public class ResultMessage<T> {
    public Integer errorCode;
    public String errorMsg;
    public T data;
    public boolean ok;

    public ResultMessage() {
    }

    public ResultMessage(ErrorCode errorCode, String errorMsg) {
        this.errorCode = errorCode.getCode();
        this.errorMsg = errorMsg;
    }

    public ResultMessage(ErrorCode errorCode, T data, boolean ok) {
        this.errorCode = errorCode.getCode();
        this.errorMsg = errorCode.getMsg();
        this.data = data;
        this.ok = ok;
    }

    public ResultMessage(ErrorCode errorCode, boolean ok) {
        this.errorCode = errorCode.getCode();
        this.errorMsg = errorCode.getMsg();
        this.ok = ok;
    }

    public ResultMessage(ErrorCode errorCode, String errorMsg, T data, boolean ok) {
        this.errorCode = errorCode.getCode();
        this.errorMsg = errorMsg;
        this.data = data;
        this.ok = ok;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isOk() {
        return ok;
    }

    public void setOk(boolean ok) {
        this.ok = ok;
    }
}
